package com.yehangtech.designpattern.创建型_抽象工厂.adpater;

import java.lang.reflect.Proxy;

public class JDKProxyFactory {
    public static <T> T getProxy(Class<T> interfacesClass, ICacheAdapter iCacheAdapter) {

        CacheInvocationHandler cacheInvocationHandler = new CacheInvocationHandler(iCacheAdapter);

        return (T) Proxy.newProxyInstance(interfacesClass.getClassLoader(), interfacesClass.getInterfaces(), cacheInvocationHandler);
    }
}
